<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Text Capitalizer</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            padding: 0;
        }
        #inputArea {
            width: 300px;
            height: 100px;
        }
        #output {
            margin-top: 20px;
            font-size: 18px;
        }
        button {
            margin-top: 10px;
        }
    </style>
</head>
<body>
<h1>Text Capitalizer</h1>
<textarea id="inputArea" placeholder="Enter your text here..."></textarea>
<button id="capitalizeButton">Capitalize</button>
<button id="resetButton">Reset</button>
<div id="output"></div>

<script>
    document.getElementById('capitalizeButton').addEventListener('click', function() {
        var inputText = document.getElementById('inputArea').value;
        if (inputText) {
            var capitalizedText = capitalizeAndRemoveSpaces(inputText);
            document.getElementById('output').innerText = capitalizedText;
        }
    });

    document.getElementById('resetButton').addEventListener('click', function() {
        document.getElementById('inputArea').value = '';
        document.getElementById('output').innerText = '';
    });

    function capitalizeAndRemoveSpaces(text) {
        var words = text.split(" ");
        var builder = "";
        for (var word of words) {
            if (word) {
                builder += word.charAt(0).toUpperCase() + word.substring(1).toLowerCase();
            }
        }
        return builder;
    }
</script>
</body>
</html>